<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<input type="text" value="我是文本框" id="inp">
	<input type="text" value="输入密码" id="passwore">

	<script>
		var inpObj = document.getElementById('inp')

		var pasObj = document.getElementById('passwore')

		inpObj.onfocus = function(){
			this.value = ''
		}

		inpObj.onblur = function(){
			this.value = this.value
		}

		pasObj.onblur = function(){
			console.log(this.value)
			if(this.value.length>=6&&this.value.length<=10){
				this.style.backgroundColor = "red"
			}else{
				this.style.backgroundColor = "pink"
			}
		}

			</script>
		</body>
		</html>